﻿import 'package:get_storage/get_storage.dart';


// MQTT配置参数
class MQConfig {
  late String serverIP;
  late int serverPort;
  late String subscriptions;

  MQConfig(
      {required this.serverIP,
      required this.serverPort,
      required this.subscriptions});

  void saveToStorage() {
    GetStorage storage = GetStorage();
    storage.write('mq_server_ip', serverIP);
    storage.write('mq_server_port', serverPort);
    storage.write('mt_subscriptions', subscriptions);
  }
}


// influxdb配置参数
class DBConfig {
  late String serverIP;
  late int port;
  late String organizationName;
  late String token;
  late String bucket;
  late int batchSize;

  DBConfig(
      {required this.serverIP,
      required this.port,
      required this.organizationName,
      required this.token,
      required this.bucket,
      required this.batchSize});

  void saveToStorage() {
    GetStorage storage = GetStorage();
    storage.write('db_server_ip', serverIP);
    storage.write('db_server_port', port);
    storage.write('db_organization_name', organizationName);
    storage.write('db_token', token);
    storage.write('db_bucket', bucket);
    storage.write('db_batch_size', batchSize);
  }
}
